home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / PROCED4.MOD < prev    next >
Text File  |  1989-01-18  |  2KB  |  63 lines

  1.                                          (* Chapter 5 - Program 4 *)
  2. MODULE Proced4;
  3.  
  4. FROM InOut IMPORT WriteString, WriteCard, WriteLn;
  5.  
  6. VAR Count : CARDINAL;
  7.     Index : CARDINAL;
  8.     Other : CARDINAL;
  9.  
  10. PROCEDURE PrintSomeData;
  11. VAR Count : CARDINAL;
  12.     Apple : CARDINAL;
  13. BEGIN
  14.    Count := 7;
  15.    Other := 12;
  16.    Apple := 32;
  17.    WriteString("In PrintSomeData the variables are");
  18.    WriteCard(Index,5);
  19.    WriteCard(Count,5);
  20.    WriteCard(Other,5);
  21.    WriteCard(Apple,5);
  22.    WriteLn;
  23. END PrintSomeData;
  24.  
  25. BEGIN    (* Main program *)
  26.    FOR Index := 1 TO 3 DO
  27.       Count := Index;
  28.       Other := Index;
  29.          WriteString("In Main Program the variables are ");
  30.          WriteCard(Index,5);
  31.          WriteCard(Count,5);
  32.          WriteCard(Other,5);
  33.          WriteLn;
  34.       PrintSomeData;
  35.          WriteString("In Main Program the variables are ");
  36.          WriteCard(Index,5);
  37.          WriteCard(Count,5);
  38.          WriteCard(Other,5);
  39.          WriteLn;
  40.       WriteLn;
  41.    END;  (* of FOR loop *)
  42. END Proced4.
  43.  
  44.  
  45.  
  46.  
  47. (* Result of execution
  48.  
  49. In Main Program the variables are     1    1    1
  50. In PrintSomeData the variables are    1    7   12   32
  51. In Main Program teh variables are     1    1   12
  52.  
  53. In Main Program the variables are     2    2    2
  54. In PrintSomeData the variables are    2    7   12   32
  55. In Main Program teh variables are     2    2   12
  56.  
  57. In Main Program the variables are     3    3    3
  58. In PrintSomeData the variables are    3    7   12   32
  59. In Main Program teh variables are     3    3   12
  60.  
  61. *)
  62.  
  63.